#include <iostream>
#include <initializer_list>

using namespace std;

int sum(initializer_list<int> &it){
    int sum = 0;
    for (auto beg = it.begin(); beg != it.end(); ++beg){
        sum += *beg;
    }
    return sum;
}

int main(){
    auto it = {1, 2, 3, 4};
    cout << sum(it) <<endl;
}